var packStyle = function (style) {
  return {
    color: style.color ? style.color : 'rgba(19, 206, 102, 0.8)',
    font: style.font ? style.font : '微软雅黑',
    fontSize: packPx(style.fontSize, 20),
    opacity: style.opacity ? style.opacity : 100,
    transform: packTransform(style.transform, 'rotate(deg)'),
    top: packPx(style.top, 0),
    left: packPx(style.left, 0),
    textAlign: style.textAlign ? style.textAlign : 'center',
    width: packPx(style.width, ''),
    height: packPx(style.height, ''),
    borderWidth: packPx(style.borderWidth, 0),
    borderColor: style.borderColor ? style.borderColor : '',
    borderStyle: style.borderStyle ? style.borderStyle : '',
    backgroundColor: style.backgroundColor ? style.backgroundColor : '',
    borderRadius: packPx(style.borderRadius, 0)
  }
}

function packPx (o, def) {
  var px = parseFloat(/-?\d+/.exec(o))
  console.log(px)
  return px ? px + 'px' : def + 'px'
}

function packTransform (o, def) {
  return o || def
}

module.exports = packStyle
